package com.hxy.consumer;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;

/**
 * error日志消费
 * QueueBinding --- value 绑定的队列名称，autoDelete 是否是一个可删除的临时队列
 * Exchange --- value 交换器名称，type 交换器类型
 * key --- 路由键
 */
@Component
@RabbitListener(
        bindings = @QueueBinding(
                value = @Queue(value = "${mq.config.queue.error}", autoDelete = "true")
                , exchange = @Exchange(value = "${mq.config.exchange}", type = ExchangeTypes.DIRECT)
                , key = "${mq.config.queue.error.routing.key}"
        )
)
public class ErrorReceiver {
    @RabbitHandler
    public void process(String msg) {
        System.out.println("error...receiver：" + msg);
    }
}

